mod client;
mod server;
mod util;
mod protocol;
use clap::{Parser, Subcommand};
use client::ClientArgs;
use server::ServeArgs;

#[derive(Parser)]
#[command(
    version = "1.0",
    about = "codimiracle<codimiracle@outlook.com>",
    long_about = "clipflow is a cross platform clipboard sharing tool"
)]
struct Cli {
    // clipflow subcommand
    #[command(subcommand)]
    command: Commands,
}

#[derive(Subcommand)]
enum Commands {
    /// hosting clipflow
    Serve(ServeArgs),
    /// join clipflow server
    Join(ClientArgs),
}

fn main() {
    let cli = Cli::parse();
    match &cli.command {
        Commands::Serve(args) => {
            server::run(args);
        }
        Commands::Join(args) => {
            client::run(args);
        }
    }
}
